////
////  HTTPMethod.m
////  半饭
////
////  Created by caohaifeng on 3/12/16.
////  Copyright © 2016 caohaifeng. All rights reserved.
////
//
#import "HTTPClient.h"
//
@implementation HTTPClient

+ (instancetype)sharedHTTPMethod {
    static HTTPClient *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
         NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
        
        NSString *urlString = @"http://iosapi.itcast.cn/car/";
        
        NSURL *url = [NSURL URLWithString:urlString];
        
        instance = [[HTTPClient alloc] initWithBaseURL:url sessionConfiguration:config];
        
        instance.responseSerializer.acceptableContentTypes =[NSSet setWithObjects:@"text/html",@"text/plain", nil] ;
    });
    return instance;
}

//- (void)requestJSONDicationaryWithMethod:(MYHTTPMethod)method andURLString:(NSString *)urlString andParameters:(NSDictionary *)parameters andfinished:(void(^)(NSDictionary *dict,NSError *error))finished {
//
//    if (method == GET) {
//        [self GET:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//            
//        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
//            
//        }];
//    } else {
//        [self POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//            
//        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
//            
//        }];
//    }
//}
//
@end
